/**
 * Copyright 2013 yangming.liu<liuyangming@gmail.com>.
 *
 * This copyrighted material is made available to anyone wishing to use, modify,
 * copy, or redistribute it subject to the terms and conditions of the GNU
 * Lesser General Public License, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this distribution; if not, see <http://www.gnu.org/licenses/>.
 */
package org.bytesoft.openjta.archive;

import org.bytesoft.openjta.internal.XAResourceWrapper;

public class XAResourceArchive extends ResourceArchive {
	private static final long serialVersionUID = 1L;

	private boolean xaSupport;
	private XAResourceWrapper xaResource;

	public boolean isXaSupport() {
		return xaSupport;
	}

	public void setXaSupport(boolean xaSupport) {
		this.xaSupport = xaSupport;
	}

	public XAResourceWrapper getXAResource() {
		return xaResource;
	}

	public void setXAResource(XAResourceWrapper xaResource) {
		this.xaResource = xaResource;
	}

	public int hashCode() {
		return this.xaResource == null ? 31 : this.xaResource.hashCode();
	}

	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		} else if (!this.getClass().isInstance(obj)) {
			return false;
		}
		XAResourceArchive that = (XAResourceArchive) obj;
		if (this.xaResource == that.xaResource) {
			return true;
		} else if (this.xaResource == null || that.xaResource == null) {
			return false;
		} else {
			return this.xaResource.equals(that.xaResource);
		}
	}
}
